<template>
  <div class="body">
  <div id="clock">
    <p class="date">{{ date }}</p>
    <p class="time">{{ time }}</p>
    <div id="button">
      <a-button @click="jobManager">作业管理</a-button>
      <a-button @click="dataManager">数据管理</a-button>
    </div>
  </div>
  </div>
</template>
<script>

import { getAction } from '@api/manage'

export default {
  name: 'Home',
  data() {
    return {
      time: '',
      date: '',
      week: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
      _beforeUnload_time:'',
      _gap_time:''
    }
  },

  mounted() {
    setInterval(this.updateTime, 1000)
    this.updateTime()
  },
  methods: {
    jobManager() {
      this.$router.push('/face')
    },
    dataManager() {
      this.$router.push('/user')
    },

    updateTime() {
      const cd = new Date()
      this.time = this.zeroPadding(cd.getHours(), 2) + ':' + this.zeroPadding(cd.getMinutes(), 2) + ':' + this.zeroPadding(cd.getSeconds(), 2)
      this.date = this.zeroPadding(cd.getFullYear(), 4) + '-' + this.zeroPadding(cd.getMonth() + 1, 2) + '-' + this.zeroPadding(cd.getDate(), 2) + '   ' + this.week[cd.getDay()]
    },
    zeroPadding(num, digit) {
      let zero = ''
      for (let i = 0; i < digit; i++) {
        zero += '0'
      }
      return (zero + num).slice(-digit)
    }
  }
}
</script>
<style scoped>
.body {
  width: 100%;
  height: 100%;
  background-image: url("../assets/home.jpg");
  background-size: 100% 100%;

}
#button {
  margin-top: 50px;
}

#button .ant-btn {
  width: 250px;
  height: 110px;
  background-color: #daf6ff;
  font-size: 40px;
  font-weight: bold;
  margin: 0 20px;
  border-radius: 20px;
}

p {
  margin: 0;
  padding: 0;
}

#clock {
  font-family: 'Share Tech Mono', monospace;
  text-align: center;
  position: absolute;
  left: 50%;
  top: 55%;
  -webkit-transform: translate(-50%, -50%);
  transform: translate(-50%, -50%);
  color: white;
  text-shadow: 0 0 20px #0aafe6, 0 0 20px rgba(10, 175, 230, 0);
}

#clock .time {
  letter-spacing: 0.05em;
  font-size: 120px;
  padding: 5px 0;
}

#clock .date {
  letter-spacing: 0.1em;
  font-size: 50px;
}

</style>